<?php
namespace app\index\controller;

use think\Controller;
 use app\index\model\Blog as BlogModel;


class Blog extends Controller
{
    public function index() 
    {

 

            $list = BlogModel::show();
            // 把分页数据赋值给模板变量list 
            $this->assign('list', $list);


            // 渲染模板输出
            return $this->fetch('index');


 
    }

    public function hello($name = 'ThinkPHP5')
    {
        return 'hello,' . $name;
    }
 
    public function view(){

        $id = input('id'); 


        $view = BlogModel::view($id);
         
        $this->assign('view', $view);
 


        // 渲染模板输出
        return $this->fetch();
    }
}
